<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;

class SquareController extends BaseController
{
    public $validate = [
        "attentionList" => ["rules" => [
            "last_id" => "max:24",
        ]],
        "recommendList" => ["rules" => [
            "last_id" => "max:24",
        ]],
    ];

    /**
     * @path /square/attention-list
     * @category 广场
     * @title 关注列表
     * @method POST
     * @params [{"name":"last_id","type":"text","required":0,"example":"","desc":"【翻页时必传】当前页最后一条记录的ID"}]
     * @resBody {"success":true,"statusCode":200,"message":"操作成功","result":{"have_more":true,"list":[{"id":"动态ID","type":"动态类型，1原创文章动态，2笔记动态，3推荐文章动态，4话题动态","is_deleted":0,"created_at":"","article":{"id":"推荐文章ID","type":"类型，1推荐，2原创","cover_url":"文章封面图，如1.jpg","title":"文章标题","description":"文章描述","is_deleted":0,"is_shield":0,"created_at":"创建时间戳","target_type":1,"author":{},"count":{"collect":"收藏数","note":"笔记数","recommend":"推荐数"}}},{"id":"动态ID","type":"动态类型，1原创文章动态，2笔记动态，3推荐文章动态，4话题动态","is_deleted":0,"created_at":"","article":{"id":"原创文章ID","type":"类型，1推荐，2原创","cover_url":"文章封面图，如1.jpg","title":"文章标题","description":"文章描述","is_deleted":0,"is_shield":0,"created_at":"创建时间戳","target_type":1,"author":{"id":"24位用户ID","nickname":"用户昵称","avatar":"头像，如1.jpg"},"count":{"collect":"收藏数","note":"笔记数","recommend":"推荐数"}}},{"id":"动态ID","type":"动态类型，1原创文章动态，2笔记动态，3推荐文章动态，4话题动态","is_deleted":0,"created_at":"","note":{"id":"24位文章笔记或划线笔记ID","type":"笔记类型，1文章笔记，2划线笔记，3随手记","user_id":"24位用户ID","article_id":"24位文章ID","is_deleted":0,"is_public":1,"created_at":"10位时间戳","start_index":"文章节选开始索引","end_index":"文章节选结束索引","content":"笔记内容","selected":"文章节选内容","is_like":0,"is_collect":1,"user":{"id":"24位用户ID","nickname":"用户昵称","avatar":"头像，如1.jpg"},"article":{"id":"24位文章ID","cover_url":"文章封面图，如1.jpg","title":"文章标题","description":"文章描述","is_deleted":0,"is_shield":0,"created_at":"文章创建时间戳"},"count":{"comment":"评论数","like":"点赞数","collect":"收藏数"}}},{"id":"动态ID","type":"动态类型，1原创文章动态，2笔记动态，3推荐文章动态，4话题动态","is_deleted":0,"created_at":"","note":{"id":"24位随手记ID","type":"笔记类型，1文章笔记，2划线笔记，3随手记","user_id":"24位用户ID","article_id":"","is_deleted":0,"is_public":1,"created_at":"10位时间戳","start_index":0,"end_index":0,"content":"笔记内容","selected":"","is_like":0,"is_collect":1,"user":{"id":"24位用户ID","nickname":"用户昵称","avatar":"头像，如1.jpg"},"article":{},"image":["1.jpg","2.jpg"],"count":{"comment":"评论数","like":"点赞数","collect":"收藏数"}}}]}}
     */
    public function attentionList(Request $request)
    {
        $params = $request->all();

        $data = service()->DynamicService->getAttentionDynamicList($this->getBaseInfo($params));

        return $this->apiReturn($data);
    }

    /**
     * @path /square/recommend-list
     * @category 广场
     * @title 推荐列表
     * @method POST
     * @params [{"name":"last_id","type":"text","required":0,"example":"","desc":"【翻页时必传】当前页最后一条记录的ID"}]
     * @resBody {"success":true,"statusCode":200,"message":"操作成功","result":{"have_more":true,"list":[{"id":"推荐文章ID","type":"类型，1推荐，2原创","cover_url":"文章封面图，如1.jpg","title":"文章标题","description":"文章描述","is_deleted":0,"is_shield":0,"created_at":"创建时间戳","target_type":1,"author":{},"recommend":["1.jpg"],"count":{"collect":"收藏数","note":"笔记数","recommend":"推荐数"}},{"id":"原创文章ID","type":"类型，1推荐，2原创","cover_url":"文章封面图，如1.jpg","title":"文章标题","description":"文章描述","is_deleted":0,"is_shield":0,"created_at":"创建时间戳","target_type":1,"author":{"id":"用户ID","nickname":"用户昵称","avatar":"用户头像，如1.jpg"},"recommend":["1.jpg"],"count":{"collect":"收藏数","note":"笔记数","recommend":"推荐数"}},{"id":"24位文章笔记或划线笔记ID","type":"笔记类型，1文章笔记，2划线笔记，3随手记","user_id":"24位用户ID","article_id":"24位文章ID","is_deleted":0,"is_public":1,"created_at":"10位时间戳","start_index":"文章节选开始索引","end_index":"文章节选结束索引","content":"笔记内容","selected":"文章节选内容","is_like":0,"is_collect":1,"user":{"id":"24位用户ID","nickname":"用户昵称","avatar":"头像，如1.jpg"},"article":{"id":"24位文章ID","cover_url":"文章封面图，如1.jpg","title":"文章标题","description":"文章描述","is_deleted":0,"is_shield":0,"created_at":"文章创建时间戳"},"count":{"comment":"评论数","like":"点赞数","collect":"收藏数"}},{"id":"24位随手记ID","type":"笔记类型，1文章笔记，2划线笔记，3随手记","user_id":"24位用户ID","article_id":"","is_deleted":0,"is_public":1,"created_at":"10位时间戳","start_index":0,"end_index":0,"content":"笔记内容","selected":"","is_like":0,"is_collect":1,"user":{"id":"24位用户ID","nickname":"用户昵称","avatar":"头像，如1.jpg"},"article":{},"image":["1.jpg","2.jpg"],"count":{"comment":"评论数","like":"点赞数","collect":"收藏数"}}]}}
     */
    public function recommendList(Request $request)
    {
        $params = $request->all();

        $data = service()->RecommendSystemService->getRecommendList($this->getBaseInfo($params));

        return $this->apiReturn($data);
    }
}
